package com.example.demo2.entity;


import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
@TableName("sys_citys")
public class AddressCity {

    @TableId(type = IdType.AUTO)
    private Integer id;
    private String name;
    private Integer code;
    private Integer provinceCode;
    @TableField(exist = false)
    private List<AddressCounty> countysList;
    @TableLogic(value = "0", delval = "1")
//    由于 isDelete 添加了 @TableLogic 注解，MyBatis Plus 做所有查询操作时，自动会在 where 条件后面拼上 is_del = 0，所以 is_del 置一后，实现了逻辑删除
    @JsonProperty(access = JsonProperty.Access.WRITE_ONLY) //逻辑删除不返回给前端
    private Integer isDelete;
    @TableField(exist = false)
    private String value;
    @TableField(exist = false)
    private String label;
    @TableField(exist = false)
    private Boolean disabled;
    @TableField(exist = false)
    private List<AddressCounty> children;
}

